﻿<!DOCTYPE html>
<!--  window-icon 弹出框图 例: window-icon="http://www.qt6.com/favicon.ico"    -->
<html lang="en" window-frame="solid" window-icon="./view/icon/server-favicon.ico"></html>
<head>
	<meta charset="UTF-8">
	<title>popup</title>
    <link rel="stylesheet" type="text/css" href="./view/css/index.css">
</head>
<body id="body" role="window-caption">
    <div id="copepopup">
        <div class="addtaskmodetop skinbg" style="background-image: url(./view/img/boxbg.png);">
            <div class="title fl" >
                <img src="./view/img/logo_st.png" alt="" class="fl">
                <div class="titlename">
                    数据库备份详情
                </div>
            </div>
            <button id="closewin" class="closewinicon topiconBg addmodeclosebtn" style="background-image: url(./view/img/topicon.png);"></button>
        </div>
        <div class="showmess">
            <div class="nonebox">
                <img src="./view/img/NOneimg.png" alt="">
                <p>暂无数据</p>
            </div>
            <div class="showtablemont disp" >
                    <table border="0" cellpadding="0" cellspacing="0">
                        <thead>
                            <tr>
                                <th>文件名</th>
                                <th>文件大小</th>
                                <th>备份时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody class="respfile">
                                    
                        </tbody>
                    </table>
                </div>
        </div>
    </div>
    <script type="text/tiscript" src="./view/tiscript/index.tis"></script>
    <script type="text/tiscript" src="./view/tiscript/public.tis"></script>
    <script type="text/tiscript">
        moveToScreenCenter(682,447);
        self.ready = function() {
            var respflist = view.parameters["respflist"]
            $(.respfile).html = datafile(respflist);
        }
        function datafile(resp){
            var restb = ""
            var idarr = []
            if(resp || resp.length > 0){
                idarr = []
                for (var (key,val) in resp){

                    restb += 
                    `
                        <tr >
                            <td>`+val.file_name+`</td>
                            <td>`+toInteger(val.file_source_size)+`KB</td>
                            <td>`+val.create_time+`</td>
                            <td class="button">
                                <button class="layui-btn" linkserver="`+val.fsserver+`" sourcefile="`+val.file_name+`" linkdir="`+val.fs_file_dir+`" sourcemd5="`+val.file_md5+`" linkname="`+val.fs_file_name+`" create_time="`+ val.create_time +`" sourcekeyfile="`+val.keyfile+`">下载</button>
                            </td>
                        </tr>
                    `
                }
                $(.nonebox).style["display"] = "none"
                $(.disp).style["display"] = "block"
                return restb

            }else{
                $(.nonebox).style["display"] = "block"
                $(.disp).style["display"] = "none"
            }
        }

        event click $(button) (evt, element) {   
            if(this.attributes["linkserver"]){
                    var downloadobj = {};
                    downloadobj.filename = this.attributes["linkname"];
                    downloadobj.fileserver = this.attributes["linkserver"];
                    downloadobj.filedir = this.attributes["linkdir"];
                    downloadobj.sourcekeyfile = this.attributes["sourcekeyfile"]; 
                    downloadobj.sourcefile = this.attributes["sourcefile"];
                    downloadobj.sourcemd5 = this.attributes["sourcemd5"];
                    if(downloadobj){
                        var argument = {
                            "newin":view.parameters["newin"],
                            "alertwin":view,
                            "type":"downlod",
                            "title":"下载备份文件",
                            "text":"下载时间是" + this.attributes["create_time"] + "的备份文件",
                            "buttons":[{id:"closekey",text:"取消"},{id:"yeskey",text:"确认"}],
                            "downloadobj":downloadobj,
                            "success":view.parameters["success"],
                            "error":view.parameters["error"]
                        }
                        view.dialog({
                            //加载到对话框中的URL，可加载本地文件
                            url: "./view/popup.html",
                            //对话框的x，y坐标
                            x: 0,
                            y: 0,
                            //窗口的宽度，高度
                            width: 272,
                            height: 170,
                            //是否是客户区，如果为真，那么x，y，width，height作为客户区坐标，而不是窗口
                            client: false,
                            //对话框 参数
                            parameters: argument,
                            //对话框标题
                            caption: "新对话框",
                            //相对于屏幕窗口对齐
                            alignment: 1,
                        });
                    }
             
            }
        }
    </script>
</body>
</html>